#pragma once

#include <allegro5/allegro.h>
#include "TestArrow.hpp"
#include <vector>
#include "Vector.hpp"

class LevelGrid
{
private:
	const static char _TOWER_CHAR = 't';

	std::shared_ptr<ALLEGRO_BITMAP>	_tower_grid;

	float							_element_width;
	float							_element_height;
	unsigned						_grid_rows;
	unsigned						_grid_columns;
	std::vector<std::vector<char>>	_grid;

	Vector _position;

	std::vector<TestArrow>			_towers;

	char _GetGridCharAtCursorPosition(const Vector& cursor_position);
	Vector _GetGridElementPositionAtCursorPosition(const Vector& cursor_position);
	bool _IsCursorOverGrid(const Vector& cursor_position);

public:
	LevelGrid();

	void PlaceTowerAtLocation(const Vector& cursor_position);

	void Draw();
};